#ifndef Q_PCL_PLUGIN_ALIGNMENT_HEADER
#define Q_PCL_PLUGIN_ALIGNMENT_HEADER

#include "BaseFilter.h"


#include <sensor_msgs/PointCloud2.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/registration/icp.h>

class AlignmentDialog;

class Alignment : public BaseFilter
{
	friend class AlignmentDialog;
    Q_OBJECT

public:
    Alignment();
	virtual ~Alignment();

	//inherited from BaseFilter
	virtual int compute();


protected:

	//inherited from BaseFilter
    virtual int openDialog();
	virtual void getParametersFromDialog();
	int checkSelected();

	void uninit();

	AlignmentDialog* m_dialog;

	//cc-PointClouds
	ccPointCloud* cc_tgt_cloud;
	ccPointCloud* cc_src_cloud;

	Eigen::Matrix4f icpTransf;
	Eigen::Matrix4f nPointTransf;


	pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;

	pcl::PointCloud<pcl::PointXYZ>::Ptr tgt_cloud;
	pcl::PointCloud<pcl::PointXYZ>::Ptr src_cloud;

	std::vector<Eigen::Vector3f> tgt_points;
	std::vector<Eigen::Vector3f> src_points;


public slots:
	void loadTargetCloud(float x,float y,float z);
	void loadSourceCloud(float x,float y,float z);

	void tgtPointPicked(size_t id, float x,float y,float z);
	void srcPointPicked(size_t id, float x,float y,float z);

	void nPointTransformation();

	void icpAlign();

};

#endif
